/* Here, you should not change anything else than the argument in the call below */

/*
 * The problem with darken and lighten is:
 * window.onload can't be executed in both
 *
 */

addLoadEvent(function() {
    Darken.darkenElement('topleft');    
})

var Darken = {
	/*
	 * Takes an id to an element and darkens its colour a notch...
	 * You should implement the darkenElement(id) function.
	 */
	darkenElement: function(id) {
            var element = document.getElementById(id);
            var color = new RGB(window.getComputedStyle(element,null)
                .backgroundColor);
            element.onmouseout = function() {
                element.style.backgroundColor = color.getHex();
            }
            element.onmouseover = function() {
                color2 = new RGB(window.getComputedStyle(element,null)
                    .backgroundColor);
                color2.subRGB(30, 30, 30);
                element.style.backgroundColor = color2.getHex();
            }
        }
}
